package com.mykolaBlyk.graphexample;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;

public class MainActivity extends Activity implements OnClickListener{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		View mStartButton = findViewById(R.id.graphStart);
	    mStartButton.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	 @Override 
	 public void onClick(View view) {
		 EditText mEditA = (EditText) findViewById(R.id.a);
		 EditText mEditB = (EditText) findViewById(R.id.b);
		 EditText mEditC = (EditText) findViewById(R.id.c);
		 double a,b,c;
		 a=Double.parseDouble(mEditA.getText().toString());
		 b=Double.parseDouble(mEditB.getText().toString());
		 c=Double.parseDouble(mEditC.getText().toString());
		 Intent intent = new Intent(this, GraphActivity.class);
		 intent.putExtra("points", new double[]{a, b,c});
		 startActivity(intent);
	 }

}
